<template>
  <view>
    <view>
      <view>1. 容器组件</view>
      <view class="smart-item" @click="goDetailPage('view')"><text>view视图</text></view>
      <view class="smart-item" @click="goDetailPage('scroll-view')"><text>scroll-view视图</text></view>
      <view class="smart-item" @click="goDetailPage('swiper')"><text>swiper视图</text></view>
    </view>
    <view>
      <view>2. 基础内容</view>
      <view class="smart-item" @click="goDetailPage('text')"><text>text文本编辑</text></view>
      <view class="smart-item" @click="goDetailPage('rich-text')"><text>rich-text文本编辑</text></view>
      <view class="smart-item" @click="goDetailPage('progress')"><text>progress进度条</text></view>
    </view>
    <view>
      <view>3. 表单组件</view>
      <view class="smart-item" @click="goDetailPage('button')">button按钮</view>
      <view class="smart-item" @click="goDetailPage('radio')">radio单选按钮</view>
      <view class="smart-item" @click="goDetailPage('input')">input输入控件</view>
      <view class="smart-item" @click="goDetailPage('picker')">picker选择列表</view>
      <view class="smart-item" @click="goDetailPage('slider')">slider滑块</view>
      <view class="smart-item" @click="goDetailPage('switch')">switch开关</view>
      <view class="smart-item" @click="goDetailPage('textarea')">textarea多行文本</view>
      <view class="smart-item" @click="goDetailPage('checkbox')">checkbox多选框</view>
      <view class="smart-item" @click="goDetailPage('form')">form表单</view>
    </view>
    <view>
      <view>4. 媒体组件</view>
      <view class="smart-item" @click="goDetailPage('image')">image图片</view>
      <view class="smart-item" @click="goDetailPage('audio')">audio音频</view>
      <view class="smart-item" @click="goDetailPage('video')">video视频</view>
    </view>
    <view>
      <view>5. 地图组件</view>
      <view class="smart-item" @click="goDetailPage('map')">map地图</view>
    </view>
    <view>
      <view>6. 导航组件</view>
      <view class="smart-item" @click="goDetailPage('navigator')">navigator导航组件</view>
    </view>
    <!-- 新增test组件的使用 -->
    <test :title="title" :name="name"></test>
  </view>
</template>

<script>
import test from '../../../../components/test.vue'

export default {
  data() {
    return {
      title: 'Hello',
      name: 'lilinqi'
    };
  },
  components: {
    test
  },
  methods: {
    // 点击跳转事件
    goDetailPage(e) {
      // 打印日志
      console.log(e);
      // 跳转
      uni.navigateTo({
        url: '/pages/components/' + e + '/' + e,
      });
    },
  },
};
</script>

<style>
.smart-item {
  background-color: #f1f1f1; /* 背景色 */
  font-size: 40upx; /* 字体大小 */
  margin: 20upx; /* 外间距 */
  height: 80upx; /* 行高 */
  line-height: 80upx;
  padding-left: 30upx;
}
</style>
<template>
  <view>
    <view>
      <view>1. 容器组件</view>
      <view class="smart-item" @click="goDetailPage('view')"><text>view视图</text></view>
      <view class="smart-item" @click="goDetailPage('scroll-view')"><text>scroll-view视图</text></view>
      <view class="smart-item" @click="goDetailPage('swiper')"><text>swiper视图</text></view>
    </view>
    <view>
      <view>2. 基础内容</view>
      <view class="smart-item" @click="goDetailPage('text')"><text>text文本编辑</text></view>
      <view class="smart-item" @click="goDetailPage('rich-text')"><text>rich-text文本编辑</text></view>
      <view class="smart-item" @click="goDetailPage('progress')"><text>progress进度条</text></view>
    </view>
    <view>
      <view>3. 表单组件</view>
      <view class="smart-item" @click="goDetailPage('button')">button按钮</view>
      <view class="smart-item" @click="goDetailPage('radio')">radio单选按钮</view>
      <view class="smart-item" @click="goDetailPage('input')">input输入控件</view>
      <view class="smart-item" @click="goDetailPage('picker')">picker选择列表</view>
      <view class="smart-item" @click="goDetailPage('slider')">slider滑块</view>
      <view class="smart-item" @click="goDetailPage('switch')">switch开关</view>
      <view class="smart-item" @click="goDetailPage('textarea')">textarea多行文本</view>
      <view class="smart-item" @click="goDetailPage('checkbox')">checkbox多选框</view>
      <view class="smart-item" @click="goDetailPage('form')">form表单</view>
    </view>
    <view>
      <view>4. 媒体组件</view>
      <view class="smart-item" @click="goDetailPage('image')">image图片</view>
      <view class="smart-item" @click="goDetailPage('audio')">audio音频</view>
      <view class="smart-item" @click="goDetailPage('video')">video视频</view>
    </view>
    <view>
      <view>5. 地图组件</view>
      <view class="smart-item" @click="goDetailPage('map')">map地图</view>
    </view>
    <view>
      <view>6. 导航组件</view>
      <view class="smart-item" @click="goDetailPage('navigator')">navigator导航组件</view>
    </view>
    <!-- 新增test组件的使用，包含事件监听和数据展示 -->
    <test :title="title" @myEven="getNum"></test>
    这是子组件传递过来的数据{{num}}
  </view>
</template>

<script>
import test from '../../../../components/test.vue'

export default {
  data() {
    return {
      title: 'Hello',
      num: 0
    };
  },
  components: {
    test
  },
  methods: {
    // 点击跳转事件
    goDetailPage(e) {
      console.log(e);
      uni.navigateTo({
        url: '/pages/components/' + e + '/' + e,
      });
    },
    // 子组件传值的回调方法
    getNum(num) {
      console.log(num);
      this.num = num;
    }
  },
};
</script>

<style>
.smart-item {
  background-color: #f1f1f1;
  font-size: 40upx;
  margin: 20upx;
  height: 80upx;
  line-height: 80upx;
  padding-left: 30upx;
}
</style>
<template>
  <view>
    <view>
      <view>1. 容器组件</view>
      <view class="smart-item" @click="goDetailPage('view')"><text>view视图</text></view>
      <view class="smart-item" @click="goDetailPage('scroll-view')"><text>scroll-view视图</text></view>
      <view class="smart-item" @click="goDetailPage('swiper')"><text>swiper视图</text></view>
    </view>
    <view>
      <view>2. 基础内容</view>
      <view class="smart-item" @click="goDetailPage('text')"><text>text文本编辑</text></view>
      <view class="smart-item" @click="goDetailPage('rich-text')"><text>rich-text文本编辑</text></view>
      <view class="smart-item" @click="goDetailPage('progress')"><text>progress进度条</text></view>
    </view>
    <view>
      <view>3. 表单组件</view>
      <view class="smart-item" @click="goDetailPage('button')">button按钮</view>
      <view class="smart-item" @click="goDetailPage('radio')">radio单选按钮</view>
      <view class="smart-item" @click="goDetailPage('input')">input输入控件</view>
      <view class="smart-item" @click="goDetailPage('picker')">picker选择列表</view>
      <view class="smart-item" @click="goDetailPage('slider')">slider滑块</view>
      <view class="smart-item" @click="goDetailPage('switch')">switch开关</view>
      <view class="smart-item" @click="goDetailPage('textarea')">textarea多行文本</view>
      <view class="smart-item" @click="goDetailPage('checkbox')">checkbox多选框</view>
      <view class="smart-item" @click="goDetailPage('form')">form表单</view>
    </view>
    <view>
      <view>4. 媒体组件</view>
      <view class="smart-item" @click="goDetailPage('image')">image图片</view>
      <view class="smart-item" @click="goDetailPage('audio')">audio音频</view>
      <view class="smart-item" @click="goDetailPage('video')">video视频</view>
    </view>
    <view>
      <view>5. 地图组件</view>
      <view class="smart-item" @click="goDetailPage('map')">map地图</view>
    </view>
    <view>
      <view>6. 导航组件</view>
      <view class="smart-item" @click="goDetailPage('navigator')">navigator导航组件</view>
    </view>
    <!-- 新增test组件的使用，包含事件监听和数据展示 -->
    <test :title="title" @myEven="getNum"></test>
    这是子组件传递过来的数据{{num}}
    <!-- 新增testA和testB组件的使用 -->
    <test-a></test-a>
    <test-b></test-b>
  </view>
</template>

<script>
import test from '../../../../components/test.vue'
import testA from '../../../../components/a.vue'
import testB from '../../../../components/b.vue'

export default {
  data() {
    return {
      title: 'Hello',
      num: 0
    };
  },
  components: {
    test,
    "test-a": testA,
    "test-b": testB
  },
  methods: {
    // 点击跳转事件
    goDetailPage(e) {
      console.log(e);
      uni.navigateTo({
        url: '/pages/components/' + e + '/' + e,
      });
    },
    // 子组件传值的回调方法
    getNum(num) {
      console.log(num);
      this.num = num;
    }
  },
};
</script>

<style>
.smart-item {
  background-color: #f1f1f1;
  font-size: 40upx;
  margin: 20upx;
  height: 80upx;
  line-height: 80upx;
  padding-left: 30upx;
}
</style>